import {legacy_createStore as createStore} from "redux";
import reducer from "./reducer";
import storage from "redux-persist/lib/storage"
import {persistReducer, persistStore} from "redux-persist";

// 持久化配置
const persistConfig = {
  key: "root",
  storage: storage,
  whitelist: ["userInfo"]
}

const myPersistReducer = persistReducer(persistConfig, reducer);

const store = createStore(myPersistReducer);

const persistor = persistStore(store)

export {
  persistor,
  store
}